<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="./icons/_cehui.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <title>茂茂睡不醒</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->

    <!-- <script type="text/javascript" src="../scripts/MouseHeart.js"></script> -->
    <!-- <script>
      function getstyle(obj, attr) {
        if (window.getComputedStyle) {
          //标准
          return getComputedStyle(obj)[attr];
        } else {
          //IE
          return obj.currentStyle[attr];
        }
      }

      function buffermove(obj, json, fn) {
        var speed = 0;
        clearInterval(obj.timer);
        obj.timer = setInterval(function () {
          var bstop = true;
          for (var attr in json) {
            var currentvalue = 0;
            if (attr === "opacity") {
              currentvalue = Math.round(getstyle(obj, attr) * 100);
            } else {
              currentvalue = parseInt(getstyle(obj, attr));
            }
            speed = (json[attr] - currentvalue) / 10;
            speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
            if (currentvalue != json[attr]) {
              if (attr === "opacity") {
                obj.style.opacity = (currentvalue + speed) / 100;
                obj.style.filter =
                  "alpha(opacity:" + (currentvalue + speed) + ")";
              } else {
                obj.style[attr] = currentvalue + speed + "px";
              }
              bstop = false;
            }
          }

          if (bstop) {
            clearInterval(obj.timer);
            fn && fn();
          }
        }, 5);
      }

      function Fireworks(x, y) {
        //x,y鼠标的位置
        this.x = x;
        this.y = y;
        var that = this;
        //1.创建烟花。
        this.ceratefirework = function () {
          this.firework = document.createElement("div"); //整个构造函数内部都可以使用
          this.firework.style.cssText = `width:5px;height:5px;background:#fff;position:absolute;left:${this.x}px;top:${document.documentElement.clientHeight}px;`;
          document.body.appendChild(this.firework);
          this.fireworkmove();
        };
        //2.烟花运动和消失
        this.fireworkmove = function () {
          buffermove(
            this.firework,
            {
              top: this.y,
            },
            function () {
              document.body.removeChild(that.firework); //烟花消失，碎片产生
              that.fireworkfragment();
            }
          );
        };
        //3.创建烟花的碎片
        this.fireworkfragment = function () {
          var num = this.ranNum(30, 60); //盒子的个数
          this.perRadio = (2 * Math.PI) / num; //弧度
          for (var i = 0; i < num; i++) {
            this.fragment = document.createElement("div");
            this.fragment.style.cssText = `width:5px;height:5px;background:rgb(${this.ranNum(
              0,
              255
            )},${this.ranNum(0, 255)},${this.ranNum(
              0,
              255
            )});position:absolute;left:${this.x}px;top:${this.y}px;`;
            document.body.appendChild(this.fragment);
            this.fireworkboom(this.fragment, i); //将当前创建的碎片传过去，方便运动和删除
          }
        };
        //4.碎片运动
        this.fireworkboom = function (obj, i) {
          //obj:创建的碎片
          var r = 0.1;
          obj.timer = setInterval(function () {
            //一个盒子运动
            r += 0.4;
            if (r >= 10) {
              clearInterval(obj.timer);
              document.body.removeChild(obj);
            }
            obj.style.left =
              that.x + 16 * Math.pow(Math.sin(that.perRadio * i), 3) * r + "px";
            obj.style.top =
              that.y -
              (13 * Math.cos(that.perRadio * i) -
                5 * Math.cos(2 * that.perRadio * i) -
                2 * Math.cos(3 * that.perRadio * i) -
                Math.cos(4 * that.perRadio * i)) *
                r +
              "px";
          }, 20);
        };
        //随机方法
        this.ranNum = function (min, max) {
          return Math.round(Math.random() * (max - min)) + min;
        };
      }
      document.onclick = function (ev) {
        var ev = ev || window.event;
        new Fireworks(ev.clientX, ev.clientY).ceratefirework();
      };
    </script> -->
  </body>
</html>
